package hn.cch.spring.boot.service.impl;

import hn.cch.spring.boot.service.FileService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;

@Service
public class FileServiceImpl implements FileService {

    private static final Logger logger = LoggerFactory.getLogger(FileServiceImpl.class);


    @Autowired
    ResourceLoader resourceLoader;

    public void getFile() {
        Resource resource = resourceLoader.getResource("classpath:/static/json.json");
        logger.info("ResourceLoader exists:{}", resource.exists());

        ClassPathResource classPathResource = new ClassPathResource("/static/json.json");
        logger.info("ClassPathResource exists:{}", classPathResource.exists());

    }


}
